from django.conf.urls.defaults import patterns, url

pattern = '[a-zA-Z0-9\-\_\.]+'

urlpatterns = patterns('apps.news.views',
    url(r'^search/$', 'search.search'),
    url(r'^search/page/(?P<page>[0-9]+)/$', 'search.search'),

    url(r'^(?P<year>[0-9]+)/$', 'base.calendar'),
    url(r'^(?P<year>[0-9]+)/page/(?P<page>[0-9]+)/$', 'base.calendar'),
    url(r'^(?P<year>[0-9]+)/(?P<month>[0-9]+)/$', 'base.calendar'),
    url(r'^(?P<year>[0-9]+)/(?P<month>[0-9]+)/page/(?P<page>[0-9]+)/$', 'base.calendar'),
    url(r'^(?P<year>[0-9]+)/(?P<month>[0-9]+)/(?P<day>[0-9]+)/$', 'base.calendar'),
    url(r'^(?P<year>[0-9]+)/(?P<month>[0-9]+)/(?P<day>[0-9]+)/page/(?P<page>[0-9]+)/$', 'base.calendar'),

    url(r'^$', 'base.main'),
    url(r'^page/(?P<page>[0-9]+)/$', 'base.main'),
    url(r'^(?P<url>%(pattern)s)/$' % { 'pattern': pattern }, 'base.category'),
    url(r'^(?P<url>%(pattern)s)/page/(?P<page>[0-9]+)/$' % { 'pattern': pattern }, 'base.category'),
    url(r'^(?P<url>%(pattern)s)/(?P<pk>[0-9]+)-(?P<record>%(pattern)s).html$' % { 'pattern': pattern }, 'base.record'),

    url(r'^(?P<pk>[0-9]+)-(?P<record>%(pattern)s).html$' % { 'pattern': pattern }, 'base.record'),


    url(r'^news/rating/update/(?P<record_pk>[0-9]+)/(?P<method>[0-9]+)/$', 'rating.update'),
)
